package com.yunfeng.common.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yunfeng.common.dao.RolePermissionDAO;
import com.yunfeng.common.entity.impl.RolePermission;
import com.yunfeng.common.service.RolePermissionService;

@Service
@Transactional
public class RolePermissionServiceImpl implements RolePermissionService {

	@Autowired
	private RolePermissionDAO rolePermissionDAO;

	/**
	 * @param rolePermission
	 * @see com.yunfeng.common.service.RolePermissionService#save(com.yunfeng.common.entity.impl.RolePermission)
	 */
	@Override
	public void save(RolePermission rolePermission) {
		rolePermissionDAO.save(rolePermission);
	}

	/**
	 * @param id
	 * @return
	 * @see com.yunfeng.common.service.RolePermissionService#get(java.lang.Long)
	 */
	@Override
	public RolePermission get(Long id) {
		return rolePermissionDAO.findOne(id);
	}

	/**
	 * @param rolePermission
	 * @see com.yunfeng.common.service.RolePermissionService#update(com.yunfeng.common.entity.impl.RolePermission)
	 */
	@Override
	public void update(RolePermission rolePermission) {
		rolePermissionDAO.save(rolePermission);
	}

	/**
	 * @param id
	 * @see com.yunfeng.common.service.RolePermissionService#delete(java.lang.Long)
	 */
	@Override
	public void delete(Long id) {
		rolePermissionDAO.delete(id);
	}

	/**
	 * @param roleId
	 * @return
	 * @see com.yunfeng.common.service.RolePermissionService#findByRoleId(java.lang.Long)
	 */
	@Override
	public List<RolePermission> findByRoleId(Long roleId) {
		return rolePermissionDAO.findByRoleId(roleId);
	}

}
